package com.lyr.test.custom;

import org.aopalliance.aop.Advice;
import org.springframework.aop.Pointcut;
import org.springframework.aop.PointcutAdvisor;
import org.springframework.beans.factory.annotation.Autowired;

public class MyAdvisor implements PointcutAdvisor {

    /**
     * 匹配对象，专门用来匹配方法、类、参数是否需要被增强
     */
    private MyDbMasterPointcut myDbMasterPointcut;

    private DbMasterAdvice dbMasterAdvice;

    public MyAdvisor(MyDbMasterPointcut myDbMasterPointcut, DbMasterAdvice dbMasterAdvice) {
        this.myDbMasterPointcut = myDbMasterPointcut;
        this.dbMasterAdvice = dbMasterAdvice;
    }

    @Override
    public Pointcut getPointcut() {
        return myDbMasterPointcut;
    }

    @Override
    public Advice getAdvice() {
        return dbMasterAdvice;
    }

    @Override
    public boolean isPerInstance() {
        return false;
    }
}

